package classFourth;

public class Student {
	private String name;
	private int grade;
	private int coursecount;
	private Course course[]=new Course[coursecount+1];
	
	public Student(String name,int grade,Course course[],int coursecount) {
		this.name=name;
		this.grade=grade;
		this.course=course;
		this.coursecount=coursecount;
	}
	
	public int getHour() {
		int sum=0;
		for(int i=1;i<=coursecount;i++) {
			sum+=course[i].hour();
		}
		return sum;
	}
	public void showMessage() {
		
		System.out.println(name+" "+grade+" grade");
		System.out.println("courses:");
		for(int i=1;i<=coursecount;i++) {
			System.out.println("("+i+")"+course[i].name()+":"+course[i].hour()+" hour");
		}
		System.out.println("hours:"+this.getHour());
		
	}

}
